'use strict'

const { defineConfig } = require('@vue/cli-service')

const path = require('path')
const resolve = dir => {
  return path.join(__dirname, dir)
}

let projectName =  process.env.PROJECT_NAME;
console.log("env.PROJECT_NAME="+ projectName)

const proConfig=require("./config/projectConfig.js");

//console.log("proejct:",proConfig[projectName])

module.exports = defineConfig({
  publicPath: "/" + projectName,
  //publicPath:"/",
  outputDir: "dist/" + projectName + "/",

  transpileDependencies: true,
  configureWebpack: config => {
    config.resolve = {
      extensions: ['.js', '.vue', '.json'],
      alias: {
        //'vue$': 'vue/dist/vue.esm.js',
        '@': resolve('src'),
        "@assets":resolve('src/assets'),
        "@components":resolve('src/components'),
        "@views":resolve('src/views'),
        "@store":resolve('src/store')
      }
    }
  },
  //
  chainWebpack: config => {
    config.resolve.alias
        .set('@', resolve('src'))
        .set('@assets', resolve('src/assets'))
        .set('@components', resolve('src/components'))
        .set('@views', resolve('src/views'))
        .set('@store', resolve('src/store'));
    // config.entry('index').add('babel-polyfill')
  },
  //使用配置项目：
  ...proConfig[projectName],

})
